<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Sa-Token-SSO-Client端-测试页（前后端分离版）</title>
</head>
<body>
<h2>Sa-Token SSO-Client 应用端（前后端分离版）</h2>
<p>当前是否登录：<b class="is-login"></b></p>
<p>
    <a href="javascript:location.href='sso-login.html?back=' + encodeURIComponent(location.href);">登录</a>
    <a href="javascript:location.href=baseUrl + '/sso/client/logout?Authorization=' + localStorage.Authorization + '&back=' + encodeURIComponent(location.href);">注销</a>
</p>
<script src="https://unpkg.zhimg.com/jquery@3.4.1/dist/jquery.min.js"></script>
<script type="text/javascript">

    // 后端接口地址
    var baseUrl = "http://127.0.0.1:5577";

    // 查询当前会话是否登录
    $.ajax({
        url: baseUrl + '/authUser/isLogin',
        type: "post",
        dataType: 'json',
        headers: {
            "X-Requested-With": "XMLHttpRequest",
            "Authorization": localStorage.getItem("Authorization")
        },
        success: function(res){
            $('.is-login').html(res.data + '');
        },
        error: function(xhr, type, errorThrown){
            return alert("异常：" + JSON.stringify(xhr));
        }
    });

</script>
</body>
</html>
